use bevy::prelude::*;
use bevy_ui_builder::{
    class::{CRes, GameCommands, Qb},
    widget::{root, sprite},
};
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2dBundle::default());
    let mut gc = GameCommands::new(&mut commands);
    gc.insert(asset_server.as_ref());
    root((), &mut gc, |gc| {
        sprite(test_class, gc);
    });
}

fn test_class(mut sprite: Qb<SpriteBundle>, _: CRes<AssetServer>) {
    sprite.sprite.custom_size = Some(Vec2::new(100.0, 100.0));
    sprite.sprite.color = Color::RED;
}
